<?php

declare(strict_types=1);

namespace App\Model\Payment;

use App\Model\Model;
use App\Traits\Model\Payment\Payment as PaymentTraits;

/**
 * @property int $id 
 * @property int $user_id 用户ID
 * @property string $order_no 订单号码
 * @property string $no 单号
 * @property string $amount 金额
 * @property array $request_body 请求信息
 * @property array $response_body 响应信息
 * @property array $notify_body 回调信息
 * @property string $process_at 处理时间
 * @property int $type 支付类型|{"1":"订单支付","2":"订单退款"}
 * @property string $code 支付编码
 * @property \Carbon\Carbon $created_at 
 * @property \Carbon\Carbon $updated_at 
 * @property string $deleted_at 
 */
class Payment extends Model
{
    use PaymentTraits;

    /**
     * The table associated with the model.
     */
    protected ?string $table = 'payment';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = ['id', 'user_id', 'order_no', 'no', 'amount', 'request_body', 'response_body', 'notify_body', 'process_at', 'type', 'code', 'created_at', 'updated_at', 'deleted_at'];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = [
        'id' => 'integer',
        'user_id' => 'integer',
        'type' => 'integer',
        'request_body' => 'array',
        'response_body' => 'array',
        'notify_body' => 'array',
        'created_at' => 'datetime',
        'updated_at' => 'datetime'
    ];

    /**
     * 自动新增
     * @var array|string[]
     */
    public array $insert = [
        'no'
    ];
}
